﻿using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Linq.Expressions;

namespace Cjc.Data.Mapping
{
	public abstract class QueryContextBase
	{
		public virtual TextWriter Log { get; set; }

		public virtual IQueryable<T> CreateQuery<T>() { return new TranslatingEnumerableQuery<T>( this ); }

		public virtual IQueryable<T> CreateQuery<T>( Expression expression ) { return new TranslatingEnumerableQuery<T>( this, expression ); }

		public abstract LambdaExpression TranslateToLambda( Expression expression );

		public abstract IEnumerable<T> GetEnumerable<T>( LambdaExpression expression );

		public abstract T Execute<T>( LambdaExpression expression );
	}
}